<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
   <meta charset="utf-8" />
   <title>利导科技客户关系管理系统  | 员工列表</title>
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta content="width=device-width, initial-scale=1.0" name="viewport" />
   <meta content="" name="description" />
   <meta content="" name="author" />
   <meta name="MobileOptimized" content="320">
   <!-- BEGIN GLOBAL MANDATORY STYLES -->          
   <link href="${base}/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
   <link rel="stylesheet" type="text/css" href="${base}/assets/plugins/jquery-multi-select/css/multi-select.css" />
   <!-- END GLOBAL MANDATORY STYLES -->
   <!-- BEGIN PAGE LEVEL STYLES -->
   <link rel="stylesheet" type="text/css" href="${base}/assets/plugins/select2/select2_metro.css" />
   <link rel="stylesheet" href="${base}/assets/plugins/data-tables/DT_bootstrap.css" />
   <link rel="stylesheet" type="text/css" href="${base}/assets/plugins/bootstrap-datepicker/css/datepicker.css">
   <link rel="stylesheet" type="text/css" href="${base}/assets/plugins/bootstrap-timepicker/compiled/timepicker.css">
   <link rel="stylesheet" type="text/css" href="${base}/assets/plugins/bootstrap-datetimepicker/css/datetimepicker.css">
   <!-- END PAGE LEVEL STYLES -->
   <!-- BEGIN THEME STYLES --> 
   <link href="${base}/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/css/style.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/css/plugins.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/css/themes/default.css" rel="stylesheet" type="text/css" id="style_color"/>
   <link href="${base}/assets/css/custom.css" rel="stylesheet" type="text/css"/>
   <!-- END THEME STYLES -->
   <link rel="shortcut icon" href="${base}/assets/img/favicon.ico" />
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
   <#include "header.ftl">
   <div class="clearfix"></div>
   <!-- BEGIN CONTAINER -->
   <div class="page-container">
      <!-- BEGIN SIDEBAR -->
      <#include "main_menu.ftl">
      <!-- END SIDEBAR -->
      <!-- BEGIN PAGE -->
      <div class="page-content">
      	<#include "changePassword.ftl">
         <#include "system-set.ftl">
         <#include "viewTracking.ftl">
         <!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
         <div class="modal" id="ViewContacts" tabindex="-1" role="basic" aria-hidden="true">
            <div class="modal-dialog modal-wide">
               <div class="modal-content">
                  <div class="modal-header">
                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                     <h4 class="modal-title">查看联系人</h4>
                  </div>
                  <div class="modal-body">
                  	<form id="form_contacts" class="form-horizontal">
                     <#include "viewContacts.ftl">
                    </form> 
                  </div>
                  <div class="modal-footer">
                     <button type="button" class="btn default" data-dismiss="modal">Close</button>
                  </div>
               </div>
               <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
         </div>
         <!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
         <!-- BEGIN PAGE HEADER-->
         <div class="row">
            <div class="col-md-12">
               <!-- BEGIN PAGE TITLE & BREADCRUMB-->
               <h3 class="page-title">
                  	员工列表 <small>这里列出了系统中所有的员工数据，你可以在此管理它们。</small>
               </h3>
               <ul class="page-breadcrumb breadcrumb">
                  <li>
                     <i class="icon-home"></i>
                     <a href="index.html">Home</a> 
                     <i class="icon-angle-right"></i>
                  </li>
                  <li>
                     <a href="#">员工管理</a>
                     <i class="icon-angle-right"></i>
                  </li>
                  <li><a href="#">员工列表</a></li>
               </ul>
               <!-- END PAGE TITLE & BREADCRUMB-->
            </div>
         </div>
         <!-- END PAGE HEADER-->
         <!-- BEGIN PAGE CONTENT-->
         <div class="row">
            <div class="col-md-12">
               <!-- BEGIN EXAMPLE TABLE PORTLET-->
               <div class="portlet box blue">
                  <div class="portlet-title">
                     <div class="caption"><i class="icon-reorder"></i>我的客户列表</div>
                     <div class="actions">
                        <a href="${base}/admin/customer!add.action" class="btn blue"><i class="icon-pencil"></i> 新建</a>
                        <div class="btn-group">
                           <a class="btn blue" href="#" data-toggle="dropdown">
                           <i class="icon-cogs"></i> 菜单
                           <i class="icon-angle-down"></i>
                           </a>
                           <ul class="dropdown-menu pull-right">
							   <li><a href = "javascript:;" onclick = "return edit();" id = "Edit"><i class="icon-pencil"></i> 编辑</a></li>
	                           <li><a href = "javascript:;" onclick = "return deletes();" id = "Deletes"><i class="icon-trash"></i> 删除</a></li>
	                           <li><a href = "javascript:;" onclick = "resetPwd();" ><i class="icon-circle"></i> 密码重置</a></li>
                               <li class="divider"></li>
                               <li><a href="javascript:;" id = "Export"><i class="icon-signout"></i> 导出到Excel</a></li>
                               <li><a href="javascript:;" id = "Import"><i class="icon-signin"></i> 从Exce导入</a></li>
                           </ul>
                        </div>
                     </div>
                  </div>
                  <div class="portlet-body">
                     <table class="table table-striped table-bordered table-hover" id="employee">
                        <thead>
                           <tr>
                              <th style="width:8px;"><input type="checkbox" class="group-checkable" data-set="#employee .checkboxes" /></th>
                              <th class="hidden-480">状态</th>
                              <th class="hidden-480">登录名</th>
                              <th class="hidden-480">员工姓名</th>
                              <th class="hidden-480">性别</th>
                              <th class="hidden-480">职位</th>
                              <th class="hidden-480">部门</th>
                              <th class="hidden-480">电话</th>
                              <th class="hidden-480">地址</th>
                              <th class="hidden-480">操作</th>
                           </tr>
                        </thead>
                        <tbody>
                           <#if employeeList?exists>
	                        	<#list employeeList as employee>
		                           <tr class="odd gradeX">
		                              <td><input type="checkbox" class="checkboxes" value="${employee.id}" /></td>
		                              <td><span class="label label-sm
		                              		<#if employee.status?exists>
		                              			<#if employee.status="在职">label-success<#else>label-default</#if>">
		                              			${employee.status}
		                              		</#if>
		                              	  </span>
		                              </td>
		                              <td class="hidden-480"><#if employee.loginname?exists>${employee.loginname}</#if></td>
		                              <td class="hidden-480"><#if employee.fullname?exists>${employee.fullname}</#if></td>
		                              <td class="hidden-480"><#if employee.gender?exists>${employee.gender}</#if></td>
		                              <td class="hidden-480"><#if employee.position.name?exists>${employee.position.name}</#if></td>
		                              <td class="hidden-480"><#if employee.department.name?exists>${employee.department.name}</#if></td>
		                              <td class="hidden-480"><#if employee.telephone?exists>${employee.telephone}</#if></td>
		                              <td class="hidden-480"><#if employee.address?exists>${employee.address}</#if></td>
		                              <td class="hidden-480">
		                              	<a href="${base}/admin/employee!edit.action?id=${employee.id}" class="btn default btn-xs blue"><i class="icon-edit"></i> 编辑</a>
		                              </td>
		                           </tr>
	                           </#list>
                           </#if>
                        </tbody>
                     </table>
                  </div>
               </div>
               <!-- END EXAMPLE TABLE PORTLET-->
            </div>
         </div>
         <!-- END PAGE CONTENT-->
      </div>
      <!-- END PAGE -->
   </div>
   <!-- END CONTAINER -->
   <#include "footer.ftl">
   <!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
   <#include "coreJsPlugins.ftl">
   <!-- BEGIN PAGE LEVEL PLUGINS -->
   <script type="text/javascript" src="${base}/assets/plugins/jquery-validation/dist/jquery.validate.min.js"></script>
   <script type="text/javascript" src="${base}/assets/plugins/select2/select2.min.js"></script>
   <script type="text/javascript" src="${base}/assets/plugins/data-tables/jquery.dataTables.js"></script>
   <script type="text/javascript" src="${base}/assets/plugins/data-tables/DT_bootstrap.js"></script>
   <script type="text/javascript" src="${base}/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
   <script type="text/javascript" src="${base}/assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
   <script type="text/javascript" src="${base}/assets/plugins/jquery-multi-select/js/jquery.multi-select.js"></script>
   <script type="text/javascript" src="${base}/assets/plugins/jquery-multi-select/js/jquery.quicksearch.js"></script>
   <!-- END PAGE LEVEL PLUGINS -->
   <!-- BEGIN PAGE LEVEL SCRIPTS -->
   <script src="${base}/assets/scripts/app.js"></script>
   <script src="${base}/resources/scripts/employee-managed.js"></script>
   <script>
      jQuery(document).ready(function() {       
         App.init();
         EmployeeManaged.init();
      });
      function deletes(){
      	var flag = "false";
      	var idValue="";
		$("#employee tbody tr :checkbox").each(function(i){
			if($(this).attr("checked")=="checked"){
				flag = "true";
				idValue = $(this).attr("value")+","+idValue;
			}
		});
		if(flag=="false"){
			alert("没有选择任何数据,请选择一条数据!");
		}else{
			if(confirm("警告!是否删除当前选中的员工？") == true){
				$.ajax({
    	            type:"post",
    	            url:"/crm/admin/employee!deletes.action",
    	            dataType:"json",
    	            data:"ids="+idValue,
    	            cache:false,
    	            beforeSend:function(XMLHttpRequest){
    	            },
    	            success:function(json){
    	            	success = json.success;
    	            	if(success){
    	            		window.location.href="/crm/admin/employee!list.action";
    	            	}else{
    	            		alert("删除失败，请稍后重试");
    	            	}
    	            },
    	           	complete:function(XMLHttpRequest,textStatus){
    	           	},
    	          	error:function(XMLHttpRequest,textStatus,errorThrown){
    	                   alert("网络错误，请稍后重试");
    	          	}
                });
			}
		}
      	return false;
      }
      
      function edit(){
      	var flag = "false";
      	var idValue="";
		$("#employee tbody tr :checkbox").each(function(i){
			if($(this).attr("checked")=="checked"){
				flag = "true";
				idValue = $(this).attr("value");
			}
		});
		if(flag=="false"){
			alert("没有选择任何数据,请选择一条数据!");
		}else{
			window.location.href="/crm/admin/employee!edit.action?id="+idValue;
		}
      	return false;
      }
      
      function resetPwd(){
      var flag = "false";
      	var idValue="";
		$("#employee tbody tr :checkbox").each(function(i){
			if($(this).attr("checked")=="checked"){
				flag = "true";
				idValue = $(this).attr("value")+","+idValue;
			}
		});
		if(flag=="false"){
			alert("没有选择任何数据,请选择一条数据!");
		}else{
	      	if(confirm("是否重新设置员工的的密码为【000000】?") == true){
	      			var npwd = "000000";
					$.ajax({
	    	            type:"post",
	    	            url:"/crm/admin/employee!resetPasswd.action",
	    	            dataType:"json",
	    	            data:"ids="+idValue+"&npwd=000000",
	    	            cache:false,
	    	            beforeSend:function(XMLHttpRequest){
	    	            },
	    	            success:function(json){
	    	            	result = json.result;
			            	if(result){
			            		alert("重置成功");
			            	}else{
			            		alert("重置失败");
			            	}
	    	            },
	    	           	complete:function(XMLHttpRequest,textStatus){
	    	           	},
	    	          	error:function(XMLHttpRequest,textStatus,errorThrown){
	    	                   alert("网络错误，请稍后重试");
	    	          	}
	                });
	            }    
	       }     
      }
   </script>
</body>
<!-- END BODY -->
</html>